

var UIManage = require("UIManage");
const ADSdk = require("ADSdk");
cc.Class({
    extends: require("BasePopUI"),

    properties: {
        
    },

    start () {
        this.GameInitCom = cc.find("Canvas").getComponent("GameInit");
        this.ChildrenRankCom = cc.find("wx").getComponent("ChildrenRank");
    },
    //获得奖励
    GetProps(isDouble = false)
    {
        // this.ChildrenRankCom.CG2_DailyWelfare();

        if(isDouble == true)
        {
            this.GameInitCom.PopsList.Diamond += 100;
            this.GameInitCom.PopsList.Hammer += 2;
            this.GameInitCom.PopsList.Reset += 2;
        }
        else
        {
            this.GameInitCom.PopsList.Diamond += 50;
            this.GameInitCom.PopsList.Hammer += 1;
            this.GameInitCom.PopsList.Reset += 1;
        }
        // TODO TOAST 领取成功
        UIManage.Instance.ShowToast("领取成功");
        cc.sys.localStorage.setItem("TimeGift","0");//领完
        UIManage.Instance.Starting.getComponent("UIStart").TimeLoad();
        this.Close();

    },

    BtnGetProp()
    {
        this.GetProps();
    },

    BtnVideoGetProp()
    {
        // TODO 广告 视频
        ADSdk.showVideo(null, (result) => {
            if (result == 1) {
                this.GetProps(true);
            }
        })
    }
});
